<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<div id="div1"></div>
<div id="div2"></div>
</body>
<script src="itcast1.js"></script>
<script>
    var arr = [];
    for (var i = 0; i < 7; i++) {
        arr.push("歌曲"+i);
    }
    new F("#div1")[0].innerHTML=F.map(arr,function(v){
        return "<input type='checkbox'/>"+v+"</br>"
    }).join("");
    var btns=[
        { name: '全选', id: 'all' },
        { name: '全不选', id: 'no' },
        { name: '反选', id: 'fan' }
    ];
    new F("#div2")[0].innerHTML=F.map(btns,function(v){
        return '<input type="button" value="'+v.name+'"  id="'+v.id+'">'
    }).join("");
    new F("#all")[0].onclick=function(){
        new F("#div1 input").each(function(){
            this.checked=true;
        });
    };
    new F("#no")[0].onclick=function(){
        new F("#div1 input").each(function(){
            this.checked=false;
        });
    };
    new F("#fan")[0].onclick=function(){
        new F("#div1 input").each(function(){
            this.checked=!this.checked;
        });
    };
</script>
</html>